<template>
  <el-row :gutter="40" class="panel-group">
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col" v-for="(item, index) in dataList" :key="index">
      <div class="card-panel" @click="handleSetLineChartData('newVisitis')">
        <div class="card-panel-icon-wrapper" :class="item.aclass">
          <svg-icon :icon-class="item.icontext" class-name="card-panel-icon" />
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">
            {{ item.name }}
          </div>
          <count-to v-if="item.isNum" :start-val="0" :end-val="item.num" :duration="2600" class="card-panel-num" />
          <span class="card-panel-num" v-else>{{item.num}}</span>
        </div>
      </div>
    </el-col>
  </el-row>
</template>

<script>
import CountTo from 'vue-count-to'

export default {
  components: {
    CountTo
  },
  data() {
    return {
      dataList: [
        { name: '有效客资',icontext: 'peoples', aclass: 'icon-people', num: 110, isNum: true},
        { name: '进店数',icontext: 'bug', aclass: 'icon-message', num: 31, isNum: true },
        { name: '订单数',icontext: 'clipboard', aclass: 'icon-money', num:  162, isNum: true},
        { name: '应收金额',icontext: 'chart', aclass: 'icon-shopping', num: '￥1236937.16' },
        { name: '一销实收',icontext: 'component', aclass: 'icon-message', num: '￥113136.69' },
        { name: '二销实收',icontext: 'documentation', aclass: 'icon-message', num: '￥17780.00' },
        { name: '二销均价',icontext: 'edit', aclass: 'icon-money', num: '￥1121.65' },
        { name: '零散实收',icontext: 'education', aclass: 'icon-shopping', num: '￥2405.00' },
        { name: '礼服租金实收',icontext: 'email', aclass: 'icon-people', num: '￥1100.00' },
        { name: '礼服售金实收',icontext: 'example', aclass: 'icon-message', num: '￥0.00' },
        { name: '礼服其他实收',icontext: 'form', aclass: 'icon-money', num: '￥134521.69' },
        { name: '实收金额',icontext: 'guide', aclass: 'icon-message', num: '￥1100.00' },
        { name: '会员余额',icontext: 'star', aclass: 'icon-people', num: '￥1382839.27' },
        { name: '退款订单',icontext: 'link', aclass: 'icon-message', num: 12, isNum: true },
        { name: '退款金额',icontext: 'list', aclass: 'icon-people', num: '￥29764.27' },
        { name: '摄化',icontext: 'lock', aclass: 'icon-money', num: 117, isNum: true },
        { name: '补拍',icontext: 'tab', aclass: 'icon-message', num: 0, isNum: true },
        { name: '重拍',icontext: 'skill', aclass: 'icon-people', num: 1, isNum: true },
        { name: '上门拍摄',icontext: 'nested', aclass: 'icon-money', num: 1, isNum: true },
        { name: '选完数',icontext: 'message', aclass: 'icon-people', num: 27, isNum: true },
      ]
    }
  },
  // created() {
  //   this.$router.push({
  //     path: '',
  //     params:{
  //       a: 'a'
  //     }
  //   })
  //   this.$route.params.a
  // }
  methods: {
    handleSetLineChartData(type) {
      this.$emit('handleSetLineChartData', type)
    }
  }
}
</script>

<style lang="scss" scoped>
.panel-group {
  margin-top: 18px;

  .card-panel-col {
    margin-bottom: 32px;
  }

  .card-panel {
    height: 108px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;
    // background: #fff;
    // box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
    border-color: rgba(0, 0, 0, .05);

    &:hover {
      .card-panel-icon-wrapper {
        color: #fff;
      }

      .icon-people {
        background: #40c9c6;
      }

      .icon-message {
        background: #36a3f7;
      }

      .icon-money {
        background: #f4516c;
      }

      .icon-shopping {
        background: #34bfa3
      }
    }

    .icon-people {
      color: #40c9c6;
    }

    .icon-message {
      color: #36a3f7;
    }

    .icon-money {
      color: #f4516c;
    }

    .icon-shopping {
      color: #34bfa3
    }

    .card-panel-icon-wrapper {
      float: left;
      margin: 14px 0 0 14px;
      padding: 16px;
      transition: all 0.38s ease-out;
      border-radius: 6px;
      background-color: #f5f5f5;
      margin-right: 20px;
    }

    .card-panel-icon {
      float: left;
      font-size: 28px;
    }

    .card-panel-description {
      // float: right;
      font-weight: bold;
      margin: 18px;
      margin-left: 0px;

      .card-panel-text {
        line-height: 18px;
        color: rgba(0, 0, 0, 0.45);
        font-size: 16px;
        margin-bottom: 12px;
      }

      .card-panel-num {
        font-size: 20px;
      }
    }
  }
}

@media (max-width:550px) {
  .card-panel-description {
    display: none;
  }

  .card-panel-icon-wrapper {
    float: none !important;
    width: 100%;
    height: 100%;
    margin: 0 !important;

    .svg-icon {
      display: block;
      margin: 14px auto !important;
      float: none !important;
    }
  }
}
</style>
